{include file="news/header.tpl"}
{include file="module/edit.header.tpl"}

	<tr>
		<td>{$lang['CONTENT']}:[<a href="javascript:void(0);"
			onclick="upImage();">{$lang['UPLOAD']}</a>]</td>
		<td colspan="3"></td>
		</tr>
		<tr>
		<td colspan="4">
		
		<div class="span12">

		<ul class="thumbnails">
			{foreach from=$news.module item=l}
			<li id="image{$l.id}" style="width:200px;height:200px;">
			<img src="{$l.image}" class="img-polaroid">
			<input type="hidden" name="imageid[]" value="{$l.id}"> <input
				type="hidden" name="image[]" value="{$l.image}"><a href="javascript:del({$l.id})">删?</a>
			<div style="display: inline-block;">名称:
			<input type="text" name="remark[]" class="input-middle"
				value="{$l.remark}"><br> 顺序:
					<input type="text" name="weight[]" class="input-small"
				value="{$l.weight}">
				
			</div>
			</li>
			{/foreach}
		</ul>
	
		</div>
		</td>

	</tr>

	<tr>
		<td>{$lang['SUMMARY']}:</td>
		<td><textarea class="form-control" style="width: 700px;" cols="80"
			id="summary" name="summary" rows="5">{$news.summary}</textarea></td>
		<td></td>

	</tr>


	<tr>
		<td>{$lang['AUTHOR']}:</td>
		<td ><input type="text" name="author"
			class="form-control" value="{$news.author}"></td>
		<td></td>

	</tr>
		<tr>
		<td>{$lang['KEYWORD']}:</td>
		<td ><input type="text" name="keyword"
			class="input-xlarge" value="{$news.keyword}"></td>
		<td></td>

	</tr>
	<tr>
		<td>Template:</td>
		<td ><input type="text" name="template"
			class="input-xlarge" value="{$news.template}"></td>
		<td></td>

	</tr>

	<tr>
		<td></td>
		<td colspan=2 class=btnline align=center><input type="hidden"
			name="id" value="{$news.id}">
		<button type="submit" class="btn btn-primary"><i class="icon-ok"></i>{$lang['SAVE']}
		</button>
		<input type="reset" value="{$lang['RESET']}" class=btn disabled></td>
		<td></td>
	</tr>

	<tr>
		<td></td>
		<td colspan=2 class=btnline align=center></td>
		<td></td>
	</tr>

</table>

</div>
<div class="tab-pane" id="tab2">
<table class="table">


	<tr>
		<td class="span2">{$lang['TITLECOLOR']}</td>
		<td class="span8"><input type="hidden" id="mycolor"
			class="colorPicker evo-cp0" /></td>

		<td></td>
	</tr>
	<tr>
		<td>{$lang['WEIGHT']}:</td>
		<td ><input type="text" name="sort"
			value="{$news.sort}" class="input-small"></td>

		<td></td>

	</tr>
	<tr>
		<td>{$lang['VIEWS']}:</td>
		<td ><input type="text" name="views"
			value="{$news.views}" class="input-small"></td>

		<td></td>

	</tr>


	<tr>
		<td>{$lang['PREMISSION']}:</td>
		<td>
		<div ><select name="groupid" class="form-control">
			{foreach from=$group item=l key=key}

			<option value={$key} {if $news.groupid==$key}selected{/if}>{$l}</option>
			{/foreach}


		</select></div>
		</td>
		<td></td>

	</tr>

	<tr>
		<td>{$lang['PUBTIME']}:</td>
		<td ><input type="text" name="date" id="form_date"
			value="{$news.date|date_format:'%Y-%m-%d %H:%M'}"
			data-date-format="yyyy-mm-dd hh:ii" class="input-middle"></td>

		<td></td>

	</tr>

	<tr>
		<td>{$lang['STATUS']}:</td>
		<td ><input type="radio" name="status" value="0"
			{if $news.status==0}checked{/if}>{$lang['SHOW']} &nbsp;&nbsp;<input
			type="radio" name="status" value="1" {if $news.status==1}checked{/if}>{$lang['HIDDEN']}

		</td>

		<td></td>

	</tr>


	{foreach from=$extend item=l}
	<tr>
		{if $l.status==3}
		<td><input type="button" class="btn" onclick="apd('{$l.key}');"
			value="增加">{$l.type}{$l.name}</td>
		<td id="{$l.key}">{foreach from=$l.value key=k item=g} <input
			type="text" name="{$l.key}[{$k}]" value={$g}> {/foreach}</td>
		<td></td>
		{else}
		<td>{$l.name}</td>
		<td><input type="text" class="form-control" name="{$l.key}"
			value={$l.value}>({$l.key} {$lang['TYPE']}{$l.type})</td>
		<td>{if $l.status==2}<img src="{$l.{$l.type}}" width=60 height=60>{/if}</td>
		{/if}
	</tr>
	{/foreach}
	<tr>
		<td class="left">{$lang['TOOL']}</td>

		<td class="right"><script type="text/plain" id="upload_ue"></script> <input
			type="text" id="picture" name="cover" /><a href="javascript:void(0);"
			onclick="upImage();">{$lang['UPLOAD']}</a>
		</div>
		</td>
		<td class="left" id="yulan"></td>
	</tr>
	<tr>
		<td><input type="hidden" name="mid" value="{$module}"></td>
		<td colspan=2 class=btnline align=center><input type="hidden"
			name="id" value="{$news.id}"> <input type="hidden" name="views"
			value="{$news.views}" />
		<button type="submit" class="btn btn-primary"><i class="icon-ok"></i>{$lang['SAVE']}
		</button>
		<input type="reset" value="{$lang['RESET']}" class=btn disabled></td>
		<td></td>
	</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
{literal}
<script type="text/javascript"
	src="/static/bootstrap2/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript"
	src="/static/bootstrap2/js/bootstrap-datetimepicker.zh-CN.js"
	charset="UTF-8"></script>

<script type="text/javascript">
    
 
    
	var _editor;
	$(function() {
	    


	    //重新实例化一个编辑器，防止在上面的editor编辑器中显示上传的图片或者文件
	    _editor = UE.getEditor('upload_ue');
	    _editor.ready(function () {
	        //设置编辑器不可用
	        _editor.setDisabled();
	        //隐藏编辑器，因为不会用到这个编辑器实例，所以要隐藏
	        _editor.hide();
	        //侦听图片上传
	        _editor.addListener('beforeInsertImage', function (t, arg) {
	            //将地址赋值给相应的input,只去第一张图片的路径
	            $.each(arg,function(){
                    addImg(this.src,this.title);
                           });
		        	$("#picture").attr("value", arg[0].src);
		            //图片预览
		            $("#preview").attr("src", arg[0].src);
		        })
		        //侦听文件上传，取上传文件列表中第一个上传的文件的路径
		        _editor.addListener('afterUpfile', function (t, arg) {

			       
		        })
		    });
		});   
		function addImg(src,title){

			 var html='<li><div href="#" class="thumbnail"><img src="'+src+'"></div><input type="hidden" name="image[]" value="'+src+'">';
			 var remark='<div style="display:inline-block;">remark:<br><input type="text" name="remark[]" class="input-middle" value="'+title+'"> <br><input type="text" name="weight[]" value="0" class="input-middle">删除</div></li>';
           $(".thumbnails").append(html+remark);
		}  
	function del(id){
$.post('/factory/delcon',{id:id,mid:2},function(data)
	{
//alert(data.message);
	},"json")
	$("#image"+id).remove();
	}
	//弹出图片上传的对话框
	function upImage() {
	    var myImage = _editor.getDialog("insertimage");
	    myImage.open();
	}
	//弹出文件上传的对话框
	function upFiles() {
	    var myFiles = _editor.getDialog("attachment");
	    myFiles.open();
	}
	 $('#form_date').datetimepicker({
	     language:  'zh-CN',
	     format:'yyyy-mm-dd hh:ii',
	     weekStart: 1,
	     todayBtn:  0,
			autoclose: 1,
			todayHighlight: 1,
			startView: 2,
			minView: 0,
			forceParse: 0
	 });
</script>
{/literal}
{include file="news/footer.tpl"}